package com.baturu.vin.honda.dal.dao;

import com.baturu.vin.honda.dto.HondaAssemblyDTO;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Set;

/**
 * 总成非总成
 *
 * @author zhanjixun
 * @date 2018年2月24日 14:06:36
 */
public interface HondaAssemblyDAO {

    @Select("<script>" +
            "SELECT xplblk FROM honda_pblokt " +
            "INNER JOIN honda_pbldst " +
            "ON honda_pblokt.NPL = honda_pbldst.npl AND honda_pblokt.NPLBLK = honda_pbldst.nplblk " +
            "where honda_pblokt.NPL=#{npl} AND NPLBLKEDIT IN " +
            "<foreach item='item' index='index' collection='imageCodes' open='(' separator=',' close=')' > " +
            "#{item} " +
            "</foreach> " +
            "</script>")
    Set<String> queryGroupNames(@Param("npl") String npl, @Param("imageCodes") Set<String> imageCodes);

    @Select("<script>" +
            "SELECT imageCode,groupName,assPartsName,nonAssPartsName " +
            "FROM honda_assembly " +
            "WHERE imageCode in " +
            "<foreach item='item' index='index' collection='imageCodes' open='(' separator=',' close=')' > " +
            "#{item} " +
            "</foreach> " +
            "AND groupName IN " +
            "<foreach item='item' index='index' collection='groupNames' open='(' separator=',' close=')' > " +
            "#{item} " +
            "</foreach> " +
            "AND assPartsName IN" +
            "<foreach item='item' index='index' collection='partsNames' open='(' separator=',' close=')' > " +
            "#{item} " +
            "</foreach> " +
            "</script>")
    Set<HondaAssemblyDTO> queryAssembly(@Param("imageCodes") List<String> imageCodes,
                                        @Param("partsNames") List<String> partsNames,
                                        @Param("groupNames") List<String> groupNames);

}
